/**
 * 
 */
package edu.wpi.cs509.messages.server;

import edu.wpi.cs509.messages.MsgBc;
import edu.wpi.cs509.messages.client.MsgJoinGameReply;
import edu.wpi.cs509.representation.GameID;

/**
 * This class implements the observe-game request message.
 * @author sparadis
 *
 */
public class MsgObserveGame extends MsgServerContext {

	/**
	 * serializable version number
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * gId: id of game to observe
	 */
	protected GameID gId;
	
	/**
	 * Constructor
	 * @param gId - id of game to observe.
	 */
	public MsgObserveGame(GameID gId) {
		this.gId = gId;
	}

	/**
	 * Observe the game.
	 * @return MsgBc - the reply msg with the results of the observe request.
	 */
	@Override
	public MsgBc doExecuteAndGetReply() {
		//Ask to observe, return result in msg.
		return (new MsgJoinGameReply(getServer().observeGame(gId, getConnection())));
	}

}
